package com.fjnldx.mes.controller.scddglController;

import com.fjnldx.mes.domain.domainReq.DdbhReq;
import com.fjnldx.mes.domain.domainReq.ModifyPrePlanReq;
import com.fjnldx.mes.domain.domainReq.PrePlanQuery;
import com.fjnldx.mes.domain.domainRes.Result;
import com.fjnldx.mes.domain.pojo.PrePlan;
import com.fjnldx.mes.service.scddglService.SecService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/prePlan")
@Api(value = "预排计划管理", tags = "预排计划管理")
public class PrePlanController {
    @Resource
    SecService secService;

    @PostMapping("/releasePrePlan")
    @ApiOperation(value = "下达订单至预排计划", notes = "下达订单至预排计划")
    public Result releasePrePlan(@RequestBody PrePlan data) throws Exception {
        return secService.releasePrePlan(data);
    }

    @PostMapping("/queryPrePlan")
    @ApiOperation(value = "预排计划查询", notes = "预排计划查询")
    public Result queryPrePlan(@RequestBody PrePlanQuery data) throws Exception {
        return secService.queryPrePlan(data);
    }

    @PostMapping("/deletePrePlan")
    @ApiOperation(value = "删除预排计划记录", notes = "删除预排计划记录")
    public Result deletePrePlan(@RequestBody String[] array) throws Exception {
        return secService.deletePrePlan(array);
    }

    @PostMapping("/deletePrePlanByOrder")
    @ApiOperation(value = "计划详情-取消预排计划", notes = "计划详情-取消预排计划")
    public Result deletePrePlanByOrder(@RequestBody DdbhReq data) throws Exception {
        return secService.deletePrePlanByOrder(data.getDdbh());
    }

    @PostMapping("/modifyPrePlan")
    @ApiOperation(value = "修改预排计划记录", notes = "修改预排计划记录")
    public Result modifyPrePlan(@RequestBody ModifyPrePlanReq data) throws Exception {
        return secService.modifyPrePlan(data);
    }

    //@PostMapping("/queryOrderInfoByOrderNumber")
    //@ApiOperation(value = "新增预排计划-根据订单编号查询订单信息", notes = "新增预排计划-根据订单编号查询订单信息")
    //public Result queryOrderInfoByOrderNumber(String ddbh) throws Exception {
    //    return secService.queryOrderInfoByOrderNumber(ddbh);
    //}
}
